import 'package:flutter/material.dart';
import 'package:flutter_stack_trace/flutter_stack_trace.dart';
import 'package:qq_music/tools/Page/Home/Bottom.dart';
import 'package:qq_music/tools/Page/Home/ListSond.dart';
import 'package:qq_music/tools/Page/Home/SelectSond.dart'; //首页搜索框
import 'package:flutter_screenutil/flutter_screenutil.dart';

void main() => FlutterChain.capture(
      () {
        runApp(HomeView());
      },
    );

class HomeView extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new _HomeViewState();
  }
}

class _HomeViewState extends State<HomeView> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('test'),
        ),
        body: Container(
          child: Body(),
        ),
      ),
    );
  }
}

class Body extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); /* 默认 1920x1080 6splus */
    print('设备宽度:${ScreenUtil.screenWidth}'); //Device width
    print('设备高度:${ScreenUtil.screenHeight}'); //Device height
    print('设备的像素密度:${ScreenUtil.pixelRatio}'); //Device pixel density
    print('底部安全区距离:${ScreenUtil.bottomBarHeight}'); //Bottom safe zone distance，suitable for buttons with full screen
    print('状态栏高度:${ScreenUtil.statusBarHeight}px'); //Status bar height , Notch will be higher Unit px

    print('实际宽度的dp与设计稿px的比例:${ScreenUtil().scaleWidth}');
    print('实际高度的dp与设计稿px的比例:${ScreenUtil().scaleHeight}');

    print('宽度和字体相对于设计稿放大的比例:${ScreenUtil().scaleWidth * ScreenUtil.pixelRatio}');
    print('高度相对于设计稿放大的比例:${ScreenUtil().scaleHeight * ScreenUtil.pixelRatio}');
    print('系统的字体缩放比例:${ScreenUtil.textScaleFactory}');
    // return new HeadSelectSond(); //首页搜索框
    return Column(
      children: <Widget>[
        new HeadSelectSond(),
        // Expanded(
        //     child: Container(
        //   width: ScreenUtil().setWidth(570),
        // )),
        // MyStatefulWidgetOne(key: key),
        Stack(
          children: <Widget>[
            Positioned(
              //先用一个组件吧这里扩容开 否则按照最大的显示
              child: Container(
                height: ScreenUtil().setHeight(1085.0),
              ),
            ),
            Container(
              height: ScreenUtil().setHeight(978.0),
              child: GetSondList(key: key),
            ),
            /* Positioned(
              top: ScreenUtil().setHeight(995.0),
              child: new BottomView(),
            ), */
            Container(
              child: BottomView(key: bvs),
            ),
            // new GetSondList(),
          ],
        )
      ],
    ); //首页搜索框
  }
}
